package com.bigknow.appstore.web.console.app;

import com.bigknow.appstore.web.framework.entity.BaseEntity;
import com.bigknow.appstore.web.framework.entity.IEntity;
import com.bigknow.appstore.web.framework.entity.QueryField;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Reference;
import org.mongodb.morphia.annotations.Transient;

import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by 李科风 on 2016-09-21.
 */
@XmlRootElement
@Entity("application")
public class Application extends BaseEntity implements IEntity {

    @QueryField
    private String userId;

    @QueryField
    private String name;

    private String description;

    private String displayName;

    private String versionFeature;

    private String context;

    private String version;

    private String indexUrl;

    private List<String> serviceIds = new ArrayList<>();

    private List<String> roleIds = new ArrayList<>();

    private List<String> tags = new ArrayList<>();

    private String tags4Show;

    private String categoryId;

    /**
     * 如果界面选http id就是1，如果是https id就是2
     */
    private String proxyMetaId;

    /**
     * 是否启用htmlbody元素的http完整路径转换功能，默认为关闭
     * 思路是利用cache进行完整http请求路径的查找（默认查找两级）
     */
    private boolean useReponseDispatcher = false;

    /**
     * 默认页面编码，有些网页不会在http头中设置编码，会在html中设置编码，不开启useReponseDispatcher
     * 是没有问题的，开启后会造成编码混乱，这种情况下就需要设置编码了
     */
    private String defaultEncoding = "utf-8";


    //*********************security start************************

    private boolean useCallTimesSec;

    private String oneDayTimes;

    private String oneMothTimes;

    private String oneYearTimes;

    private boolean useCallDatasSec;

    private String oneDayVisits;

    private String oneMothVisits;

    private String oneYearVisits;

    //*********************security end  ************************


    @Transient
    private ApplicationCategory category;

    private String ownerId;

    @QueryField
    private ApplicationState state;

    private float star;

    private int subscribeCount;

    private String logoFile;

    private List<String> screenshotFiles = new ArrayList<>();

    private String createTime;

    private String updateTime;

    private long publishedTime;

    private String preVersionId;

    private ApplicationGateWayConfig gateWayConfig;

    private ApplicationSSOConfig ssoConfig;

    private List<String> helpFiles = new ArrayList<>();

    public String getTags4Show() {
        return tags4Show;
    }

    public void setTags4Show(String tags4Show) {
        this.tags4Show = tags4Show;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public ApplicationCategory getCategory() {
        return category;
    }

    public void setCategory(ApplicationCategory category) {
        this.category = category;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getVersionFeature() {
        return versionFeature;
    }

    public void setVersionFeature(String versionFeature) {
        this.versionFeature = versionFeature;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getIndexUrl() {
        return indexUrl;
    }

    public void setIndexUrl(String indexUrl) {
        this.indexUrl = indexUrl;
    }

    public List<String> getServiceIds() {
        return serviceIds;
    }

    public void setServiceIds(List<String> serviceIds) {
        this.serviceIds = serviceIds;
    }

    public List<String> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(List<String> roleIds) {
        this.roleIds = roleIds;
    }

    public List<String> getTags() {
        return tags;
    }

    public void setTags(List<String> tags) {
        this.tags = tags;
    }

    public String getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }

    public ApplicationState getState() {
        return state;
    }

    public void setState(ApplicationState state) {
        this.state = state;
    }

    public float getStar() {
        return star;
    }

    public void setStar(float star) {
        this.star = star;
    }

    public int getSubscribeCount() {
        return subscribeCount;
    }

    public void setSubscribeCount(int subscribeCount) {
        this.subscribeCount = subscribeCount;
    }

    public String getLogoFile() {
        return logoFile;
    }

    public void setLogoFile(String logoFile) {
        this.logoFile = logoFile;
    }

    public List<String> getScreenshotFiles() {
        return screenshotFiles;
    }

    public void setScreenshotFiles(List<String> screenshotFiles) {
        this.screenshotFiles = screenshotFiles;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public long getPublishedTime() {
        return publishedTime;
    }

    public void setPublishedTime(long publishedTime) {
        this.publishedTime = publishedTime;
    }

    public String getPreVersionId() {
        return preVersionId;
    }

    public void setPreVersionId(String preVersionId) {
        this.preVersionId = preVersionId;
    }

    public ApplicationGateWayConfig getGateWayConfig() {
        return gateWayConfig;
    }

    public void setGateWayConfig(ApplicationGateWayConfig gateWayConfig) {
        this.gateWayConfig = gateWayConfig;
    }

    public ApplicationSSOConfig getSsoConfig() {
        return ssoConfig;
    }

    public void setSsoConfig(ApplicationSSOConfig ssoConfig) {
        this.ssoConfig = ssoConfig;
    }

    public List<String> getHelpFiles() {
        return helpFiles;
    }

    public void setHelpFiles(List<String> helpFiles) {
        this.helpFiles = helpFiles;
    }

    public String getProxyMetaId() {
        return proxyMetaId;
    }

    public void setProxyMetaId(String proxyMetaId) {
        this.proxyMetaId = proxyMetaId;
    }

    public boolean isUseReponseDispatcher() {
        return useReponseDispatcher;
    }

    public void setUseReponseDispatcher(boolean useReponseDispatcher) {
        this.useReponseDispatcher = useReponseDispatcher;
    }

    public String getDefaultEncoding() {
        return defaultEncoding;
    }

    public void setDefaultEncoding(String defaultEncoding) {
        this.defaultEncoding = defaultEncoding;
    }

    public boolean isUseCallTimesSec() {
        return useCallTimesSec;
    }

    public void setUseCallTimesSec(boolean useCallTimesSec) {
        this.useCallTimesSec = useCallTimesSec;
    }

    public String getOneDayTimes() {
        return oneDayTimes;
    }

    public void setOneDayTimes(String oneDayTimes) {
        this.oneDayTimes = oneDayTimes;
    }

    public String getOneMothTimes() {
        return oneMothTimes;
    }

    public void setOneMothTimes(String oneMothTimes) {
        this.oneMothTimes = oneMothTimes;
    }

    public String getOneYearTimes() {
        return oneYearTimes;
    }

    public void setOneYearTimes(String oneYearTimes) {
        this.oneYearTimes = oneYearTimes;
    }

    public boolean isUseCallDatasSec() {
        return useCallDatasSec;
    }

    public void setUseCallDatasSec(boolean useCallDatasSec) {
        this.useCallDatasSec = useCallDatasSec;
    }

    public String getOneDayVisits() {
        return oneDayVisits;
    }

    public void setOneDayVisits(String oneDayVisits) {
        this.oneDayVisits = oneDayVisits;
    }

    public String getOneMothVisits() {
        return oneMothVisits;
    }

    public void setOneMothVisits(String oneMothVisits) {
        this.oneMothVisits = oneMothVisits;
    }

    public String getOneYearVisits() {
        return oneYearVisits;
    }

    public void setOneYearVisits(String oneYearVisits) {
        this.oneYearVisits = oneYearVisits;
    }
}
